public class Demo8 {
    public static void main(String[] args) throws InterruptedException {
        Runnable init = ()->{
            for (int i = 0; i <5 ; i++) {
                System.out.println(Thread.currentThread().getName()+"say: I'm running!");
            }
            System.out.println("I'm over!");
        };

        Thread t1 = new Thread(init,"工资");
        Thread t2 = new Thread(init,"结账");
        t1.start();
        t1.join();
        System.out.println("工资到账啦!可以买东西了!");
        t2.start();
        t2.join();
        System.out.println("买到喜欢的东西了!");
    }
}
